package com.eunion.core.common.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.Table;

import com.eunion.core.common.domain.AbstractOracleIdxObject;
import com.eunion.core.common.domain.enumeration.FileType;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;

@Entity
@Table(name = "xd_excel_upload_record")
public class ExcelUploadRecord extends AbstractOracleIdxObject {

    private static final long serialVersionUID = 1L;

    @Column(name = "dept")
    private String department;

    @Column(name = "user_name")
    private String userName;

    @Column(name = "file_name")
    private String fileName;

    @Enumerated
    @Column(name = "file_type")
    private FileType fileType;

    @Column(name = "file_Size")
    private Long fileSize;

    @Column(name = "dept_name")
    private String deptName;

    @JsonSerialize(using = DateSerializer.class)
    @Column(name = "upload_time")
    private Date uploadTime;

    @JsonSerialize(using = DateSerializer.class)
    @Column(name = "parse_time")
    private Date parseTime;

    @JsonSerialize(using = DateSerializer.class)
    @Column(name = "transport_time")
    private Date transportTime;

    @JsonSerialize(using = DateSerializer.class)
    @Column(name = "complete_time")
    private Date completeTime;

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public FileType getFileType() {
        return fileType;
    }

    public void setFileType(FileType fileType) {
        this.fileType = fileType;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public Date getUploadTime() {
        return uploadTime;
    }

    public void setUploadTime(Date uploadTime) {
        this.uploadTime = uploadTime;
    }

    public Date getParseTime() {
        return parseTime;
    }

    public void setParseTime(Date parseTime) {
        this.parseTime = parseTime;
    }

    public Date getTransportTime() {
        return transportTime;
    }

    public void setTransportTime(Date transportTime) {
        this.transportTime = transportTime;
    }

    public Date getCompleteTime() {
        return completeTime;
    }

    public void setCompleteTime(Date completeTime) {
        this.completeTime = completeTime;
    }

    // HARDCODE:目前文件上传中根本没有流程这一概念，所以状态使用hardcode
    public String getStatus() {
        return "已解析";
    }

    public String getPath() {
        return ImportUtil.getFtpPath(this);
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
}
